package com;

import myArrayList.com.heima.domain.Student;

import java.util.ArrayList;
import java.util.Scanner;

public class Test3 {
    public static void main(String[] args) {
        ArrayList<Student> list = new ArrayList<>();
        Student Stu1= getStudent();
        Student Stu2= getStudent();
        Student Stu3= getStudent();

        list.add(Stu1);
        list.add(Stu2);
        list.add(Stu3);
        for (int i = 0; i < list.size(); i++) {
            Student Stu =list.get(i);
            System.out.println(Stu.getName()+"..."+Stu.getAge());

        }

    }


    public static Student getStudent(){
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入学生姓名:");
        String name =sc.next();
        System.out.println("请输入学生年龄:");
        int age = sc.nextInt();
        Student Stu = new Student(name,age);
        return  Stu;



    }




}
